CREATE TABLE [dbo].[App_novedad]
(
[id_novedad] [bigint] NOT NULL IDENTITY(1, 1),
[descripcion] [varchar] (max) COLLATE Modern_Spanish_CI_AS NULL,
[fecha_hora] [dbo].[_fechahora] NULL,
[id_usuario] [dbo].[_nombre] NULL,
[informada] [dbo].[_logico] NULL,
[id_articulo] [dbo].[_codigo] NULL,
[id_pedido] [dbo].[_codigo] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[App_novedad] ADD CONSTRAINT [PK_novedad] PRIMARY KEY CLUSTERED  ([id_novedad]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[App_novedad] ADD CONSTRAINT [FK_App_novedad_App_articulo] FOREIGN KEY ([id_articulo]) REFERENCES [dbo].[App_articulo] ([id_articulo])
GO
ALTER TABLE [dbo].[App_novedad] ADD CONSTRAINT [FK_App_novedad_App_pedido_cab] FOREIGN KEY ([id_pedido]) REFERENCES [dbo].[App_pedido_cab] ([id_pedido])
GO
ALTER TABLE [dbo].[App_novedad] ADD CONSTRAINT [FK_App_novedad_wad_operadores] FOREIGN KEY ([id_usuario]) REFERENCES [dbo].[wad_operadores] ([cd_operador])
GO
EXEC sp_bindefault N'[dbo].[date]', N'[dbo].[App_novedad].[fecha_hora]'
GO
EXEC sp_bindefault N'[dbo].[cero]', N'[dbo].[App_novedad].[informada]'
GO
EXEC sp_addextendedproperty N'MS_Description', N'(administrador|proveedor|comercio)', 'SCHEMA', N'dbo', 'TABLE', N'App_novedad', 'COLUMN', N'id_usuario'
GO
